#include<iostream>
#include<assert.h>
#include<stdlib.h>
using namespace std;
typedef char Elemtype;
typedef struct BinNode
{
	Elemtype data;
	struct BinNode* lchild;
	struct BinNode* rchild;
}Node;
typedef struct Bin
{
	BinNode* root;
	Elemtype ref;//'#'
}Bin;
void Init_tree(Bin* t)
{
	t->ref = '#';
	t->root = NULL;
}
void Create_tree(Bin* bt, Node** t)
{
	Elemtype elem;
	cin >> elem;
	if (elem == bt->ref)
	{
		(*t) = NULL;
	}
	else
	{
		Node* node = (Node*)malloc(sizeof(Node));
		assert(node);
		node->data = elem;
		(*t)->data = node->data;
		Create_tree(bt, &((*t)->lchild));
		Create_tree(bt, &((*t)->rchild));
	}	
}
void Print_tree(Bin* bt,BinNode t)
{
	if(t!=bt->ref)
	{
		cout<<t->data;
		Print_tree(bt,t->lchild);
		Print_tree(bt,t->rchild);
	}
}
void Create_tree(Bin* t)
{
	Create_tree(t, &(t->root));
}
void Print_tree(Bin* bt)
{
	Print_tree(bt,bt->root);
}
int main()
{
	Bin my_tree;
	Init_tree(&my_tree);
	Create_tree(&my_tree);
	print_tree(&my_tree);
	return 0;
}
